package com.zzw.service.Impl;

import com.zzw.bean.*;
import com.zzw.dao.AgentMapper;
import com.zzw.dao.SysUserMapper;
import com.zzw.dao.UserRolesMapper;
import com.zzw.service.AgentService;
import com.zzw.service.SysUserService;
import com.zzw.utils.PasswordEncoderUtil;
import com.zzw.utils.WebUtils;
import lombok.extern.slf4j.Slf4j;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.StringUtils;
import org.springframework.web.multipart.MultipartFile;

import javax.annotation.Resource;
import javax.servlet.http.HttpSession;
import java.util.Collections;
import java.util.Date;
import java.util.List;

/**
 * @author 赵志伟
 * @version 1.0
 */
@SuppressWarnings({"all"})
@Service
@Slf4j
public class AgentServiceImpl implements AgentService {
    @Resource
    private AgentMapper agentMapper;

    @Override
    public List<Agent> selectAgentList() {
        return agentMapper.selectAgentList();
    }

    @Override
    public Agent selectAgentById(Integer id) {
        return agentMapper.selectAgentById(id);
    }

    @Override
    public int insertAgent(Agent agent) {
        agent.setCreateTime(new Date());
        agent.setStatus("1");
        return agentMapper.insertAgent(agent);
    }

    @Override
    public int updateAgentStatus(Integer id) {
        return agentMapper.updateAgentStatus(id);
    }
}
